<?php
/**
 * Created by PhpStorm.
 * User: R.Ice
 * Date: 2018/8/22
 * Time: 17:38
 * name:新增学校班级
 * url:/erpSchoolClass/add_school_class
 */

$osc_name                    = $route->bodyParams['osc_name'];                       /*班级名称*/
$osc_course_id               = $route->bodyParams['osc_course_id'];                 /*关联课程ID*/
$osc_classroom_id            = $route->bodyParams['osc_classroom_id'];              /*关联教室ID*/
$osc_teacher_id              = $route->bodyParams['osc_teacher_id'];                /*关联的老师ID*/
$osc_deduct_type             = $route->bodyParams['osc_deduct_type'];               /*扣课类型 0-合同扣课 1-按时扣课*/
$osc_official_student_number = $route->bodyParams['osc_official_student_number'];  /*正式学员上限*/
$osc_try_student_number      = $route->bodyParams['osc_try_student_number'];       /*试听学员上限*/
$osc_start_time              = $route->bodyParams['osc_start_time'];                /*班级的开始时间*/
$osc_end_time                = $route->bodyParams['osc_end_time'];                  /*班级的结束时间*/

$osc_type                    = $route->bodyParams['osc_type'];                      /*班级类型 0-普通班级 1-1V1班级*/
$osc_oesid                   = $route->bodyParams['osc_oesid'];                     /*关联机构ID*/

$osc_time_text               = $regexpObj->bodyV($response,$route,'osc_time_text','NORMAL');;                 /*上课时间字符串*/

$osc_leave_time                = $regexpObj->bodyV($response,$route,'osc_leave_time','NORMAL');                    /*请假时限设置 0-不限制时间 1-上课12小时之前 2-上课之前 3-上课后12小时*/
$osc_lack_course_deduct_number = $regexpObj->bodyV($response,$route,'osc_lack_course_deduct_number','NORMAL');   /*缺课扣课设置，旷课扣除的课时数（只在按时扣课的类型中有效）*/
$osc_go_class_notification     = $regexpObj->bodyV($response,$route,'osc_go_class_notification','NORMAL');       /*上课前通知 0-不通知 1-提前2小时 2-提前12小时 3-提前1天*/
$osc_leave_number              = $regexpObj->bodyV($response,$route,'osc_leave_number','NUMBER');                 /*请假次数*/
$osc_archive_time              = $regexpObj->bodyV($response,$route,'osc_archive_time','NUMBER');                 /*签到归档时间设置 0-不限制时间 1-12小时 2-一天 3-三天*/
$osc_deduct_number             = $regexpObj->bodyV($response,$route,'osc_deduct_number','NUMBER');                /*扣课数量（当扣课类型为按时扣课时有效）*/
$osc_official_student_count    = $regexpObj->bodyV($response,$route,'osc_official_student_count','NUMBER');                /*扣课数量（当扣课类型为按时扣课时有效）*/
$is_view                       = $regexpObj->bodyV($response,$route,'is_view','NUMBER');
//写入数组
$insertArr = [
    'osc_name'                      =>$osc_name,
    'osc_course_id'                 =>$osc_course_id,
    'osc_classroom_id'              =>$osc_classroom_id,
    'osc_teacher_id'                =>$osc_teacher_id,
    'osc_deduct_type'               =>$osc_deduct_type,
    'osc_deduct_number'             =>$osc_deduct_number,
    'osc_official_student_number'   =>$osc_official_student_number,
    'osc_try_student_number'        =>$osc_try_student_number,
    'osc_start_time'                =>$osc_start_time,
    'osc_end_time'                  =>$osc_end_time,
    'osc_time_text'                 =>$osc_time_text,
    'osc_type'                      =>$osc_type,
    'osc_oesid'                     =>$osc_oesid,
    'osc_leave_time'                =>$osc_leave_time,
    'osc_lack_course_deduct_number' =>$osc_lack_course_deduct_number,
    'osc_go_class_notification'     =>$osc_go_class_notification,
    'osc_leave_number'              =>$osc_leave_number,
    'osc_archive_time'              =>$osc_archive_time,
    'osc_official_student_count'    =>$osc_official_student_count,
    'is_view'                       =>$is_view,
    'osc_create_time'               =>time(),
];
//执行写入语句
$rsData = $db->mysqlDB->insert("oa_school_class",$insertArr);

//返回成功结果
$response->responseData( true, $rsData );